/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2019-03-12 Time: 23:23
 */
import {RequestAction, RequestMethod} from "../configuration/RequestConfiguration"
import {AppRequestPath} from "../configuration/AppConfig"
import {API_PROCEDURE2} from "../constant/API"
import global from "../configuration/global";

//获取房态盘信息
export const procRetrieveRoomsViewAs = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'RetrieveRoomsViewAs',
            'jn': str,
            'jnJson2': JSON.stringify({"output":{"json":"null"}}),
            'jnJson3':'list',
        },
        action
    )
};

//获取房态盘不显示图标合集
export const procHoReservationDefault = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'RetrieveRoomsViewAsDefault',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

export const procRetrieveFtpCustom = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu": "ExecRetrieveJson",
            "jn": {
                "where": {
                    "1": "1"
                },
                "fileds": {
                    "fileds": ["scode","stext","bgcolor","tcolor"]
                },
                "table": {
                    "table": "ho_ftp_custom"
                },
                "wherestring": ["@@WS", ""]
            },
            "jnJson2": "{}",
        },
        action
    )
};




//获取房态盘信息
export const retrieveOrderMsg = (action,str,procedure) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': procedure,
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

//获取房态盘信息
export const retrieveOrderMsgByRoom = (action,str,procedure) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': procedure,
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};


//获取客人账
export const retrieveRoomHo_Ledger = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKRetrieveRoomHo_Ledger',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

export const retrieveScurryDefault = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKOrderSweepScurryDefault',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

export const orderSweepScurrySave = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'OrderSweepScurrySave',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

export const HoLoseAddRequest = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'HoLoseAdd',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};



export const retrieveWHSKDict = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKRetrieveCSDict',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};

export const setRoomOOOSRequest = (action,str,procedure) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': procedure,
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};




//修改房态日志
export const retrieveLogRecordRequest = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu": "ExecRetrieveJson",
            "jn": {
                "where": {
                    "1": "1"
                },
                "fileds": {
                    "fileds": ["id","log_date","log_time","log_type","comment","gno","grno","gname","log_ncard","log_user","depart","no","activity","room","table_name","column_name","item","modified","log_date_time1"]
                },
                "table": {
                    "table": "viewJqGrid_log_record_all"
                },
                "wherestring": ["@@WS", str]
            },
            "jnJson2": "{}",
        },
        action
    )
};

export const retrieveHoLoseRequest = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu": "ExecRetrieveJson",
            "jn": {
                "where": {
                    "1": "1"
                },
                "fileds": {
                    "fileds": ["*"]
                },
                "table": {
                    "table": "ho_lose"
                },
                "wherestring": ["@@WS", str]
            },
            "jnJson2": JSON.stringify([{"page":1,"sord":"asc","rows":-1,"sidx":"sn"}]),
        },
        action
    )
};



export const retrieveroomooosRequest = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu": "ExecRetrieveJson",
            "jn": {
                "where": {
                    "1": "1"
                },
                "fileds": {
                    "fileds": ["room","lock","sell","status","reason","remarks","r_status","userid","last_date","last_time","sn","log_ncard","log_user","rmtype"]
                },
                "table": {
                    "table": "viewJqGrid_ho_rmoo"
                },
                "wherestring": ["@@WS", str]
            },
            "jnJson2": "{}",
        },
        action
    )
};




export const housekeepingSweepSetStatusRequest = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'HousekeepingSweepSetStatus',
            'jn': str,
            'jnJson2': '{}',
        },
        action
    )
};










